﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.UI.HtmlControls;

namespace PeisongWeb
{
    public partial class seller_index : customerPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                rep_parentBind();
            }
        }
        void rep_parentBind()
        {
            DataTable dt;
            int companyid = logic.customer.getCompanyId();
            dt = DAL.SellerRange.sellerRaneParentCategory(logic.customer.companyId);
            if (dt.Rows.Count != 0)
            {
                rpt_parentProduct.DataSource = dt;
                rpt_parentProduct.DataBind();
            }
        }

        protected void rpt_parentProduct_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                DataTable dt;
                Repeater rpt = e.Item.FindControl("rpt_cateProduct") as Repeater;
                HtmlInputHidden hdparentid = e.Item.FindControl("hd_parentid") as HtmlInputHidden;
                int companyid = logic.customer.getCompanyId();
                int parentid = 0;
                int.TryParse(hdparentid.Value, out parentid);
                dt = DAL.SellerRange.sellerRangeChildCategory(logic.customer.companyId, parentid);
                rpt.DataSource = dt;
                rpt.DataBind();

            }
        }
    }
}
